package com.xdy.redis.demo.controller;

import com.xdy.redis.demo.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: XDY.
 * @Email: 2280944114@qq.com
 * @CreateTime: 2023-05-07  16:31
 * @Description: TODO
 * @Version: 1.0
 */
@Api(tags = "订单接口")
@RestController
@RequestMapping("/redis")
public class OrderController {

    @Resource
    private OrderService orderService;

    @ApiOperation("新增订单")
    @PostMapping
    public void addOrder() {
        orderService.addOrder();
    }

    @ApiOperation("查询订单")
    @GetMapping("/order/{keyId}")
    public String getOrder(@ApiParam(name = "keyId", value = "键id") @PathVariable Integer keyId) {
        return orderService.getOrder(keyId);
    }
}
